function rever (str) {
  let arr = str.split('')
  let left = 0
  let right = arr.length - 1
  while (left < right) {
    [arr[right], arr[left]] = [arr[left], arr[right]]
    left++
    right--
  }
  return arr.join('')
}
let str = 'tonghuasuxn'
console.log(rever(str));